#include "ecb/base/Properties.h"
#include <sstream>

namespace ecb {

    Properties::Properties(const std::string& id, const std::string& name,
            int dimensions, scalar minimum, scalar maximum, bool minimization)
    : _id(id), _name(name), _dimensions(dimensions),
    _minimum(minimum), _maximum(maximum), _minimization(minimization) { }

    Properties::~Properties() { }

    void Properties::setId(const std::string& id) {
        this->_id = id;
    }

    std::string Properties::getId() const {
        return this->_id;
    }

    void Properties::setName(const std::string& name) {
        this->_name = name;
    }

    std::string Properties::getName() const {
        return this->_name;
    }

    void Properties::setMinMax(scalar minimum, scalar maximum) {
        this->_minimum = minimum;
        this->_maximum = maximum;
    }

    void Properties::setMinimum(scalar minimum) {
        this->_minimum = minimum;
    }

    scalar Properties::getMinimum() const {
        return this->_minimum;
    }

    void Properties::setMaximum(scalar maximum) {
        this->_maximum = maximum;
    }

    scalar Properties::getMaximum() const {
        return this->_maximum;
    }

    void Properties::setDimensions(int dimensions) {
        this->_dimensions = dimensions;
    }

    int Properties::getDimensions() const {
        return this->_dimensions;
    }

    void Properties::setMinimization(bool minimization) {
        this->_minimization = minimization;
    }

    bool Properties::isMinimization() const {
        return this->_minimization;
    }

    void Properties::setMaximization(bool maximization) {
        this->_minimization = !maximization;
    }

    bool Properties::isMaximization() const {
        return !this->_minimization;
    }

    std::string Properties::toString() const {
        std::stringstream ss;
        ss
                << _id << ":" << (_minimization ? "[m]" : "[M]") << _name << "("
                << _minimum << ", " << _maximum << ") in R^" << _dimensions;
        return ss.str();
    }






}



